define(['knockout',
    'platform.common',
    'bootbox',
    'knockout-bsTable',
    'knockout-component',
    'sco.msg'], function (ko, platform) {

    var rest = {};

    var bootbox = require('bootbox');
    var kbTable = require('knockout-bsTable');
    var investInfo = function () {
        self = this;
        self.columns = [
            {field: 'checkbox', checkbox: true, width: 30},
            {title: '投资客户标识', field: 'ivs_id', width: 100, visible: false},
            {title: '合同编号', field: 'contract_no', align: "center", width: 160},
            {
                title: '流程状态',
                field: 'node_status',
                align: "center",
                width: 120,
                formatter: function (value, row, index) {
                    // for (var i = 0; i < invest_node_status.length; i++) {
                    //     if (invest_node_status[i].code_value == value) {
                    //         return invest_node_status[i].code_text;
                    //     }
                    // }
                    return value;
                }
            },
            {title: '业务发生时间', field: 'cr_date', align: "center", width: 140},
            {title: '姓名', field: 'ivs_name', align: "left", width: 80},
            {title: '电话', field: 'ivs_phone', align: "center", width: 120},
            {title: '身份证号', field: 'ivs_idcard', align: "left", width: 160},
            {title: '本人银行卡号', field: 'ivs_bankcard', align: "left", width: 160},
            {title: '开户行', field: 'ivs_bank', align: "center", width: 120},
            {title: '投资额(￥)', field: 'ivs_tze', align: "right", width: 120},
            {title: '期限', field: 'ivs_qx', align: "center", width: 60},
            {
                title: '类型', field: 'time_type', align: "center", width: 60, formatter: function (value, row, index) {
                // return platform.common.getJsonText(value, wyd.common.time_type);
            }
            },
            {title: '到期日', field: 'ivs_bxdqr', align: "center", width: 80},
            {title: '应支付投资本息(￥)', field: 'ivs_yfbx', align: "right", width: 120},
            {
                title: '还款方式', field: 'ivs_hkfs', align: "center", width: 120, formatter: function (value, row, index) {
                // for (var i = 0; i < pub_hkfs.length; i++) {
                //     if (pub_hkfs[i].code_value == value) {
                //         return pub_hkfs[i].code_text;
                //     }
                // }
                return value;
            }
            },
            {
                title: '距到期日天数',
                field: 'ivs_jdqts',
                align: "center",
                width: 100,
                formatter: function (value, row, index) {
                    // if (value != "") {
                    //     var date = platform.common.getCurrentDate("yyyy-MM-dd");
                    //     var bxdqr = new Date(row.ivs_bxdqr);
                    //     var diff = bxdqr.diff(date);
                    //     return diff;
                    // }
                }
            },
            {
                title: '营业员', field: 's_acc_id', align: "center", width: 140, formatter: function (value, row, index) {
                // return account.getAccNoAndName(value);
            }
            },
            {
                title: '财务员', field: 'f_acc_id', align: "center", width: 140, formatter: function (value, row, index) {
                // return account.getAccNoAndName(value);
            }
            },
            {title: '编辑状态', field: 'edit_status', align: 'center', width: 100, visible: false},
            {title: '利率', field: 'ivs_ll', align: 'center', width: 100, visible: false}
        ];
        self.investInfoTable = new kbTable.bootstrapTableViewModel({
            url: platform.mapUrl('~/rest/fico/investinfo/selectByPage'),
            columns: self.columns,
            toolbar: '#toolbar',
            queryParams: function (params) {
                return {
                    pageNumber: params.offset / params.limit + 1,
                    pageSize: params.limit,
                    isPaging: true
                };
            }
        });
        self.fnAdd = function (root) {
        };
        self.fnRemove = function () {

        };
        self.fnEdit = function () {

        };
        self.fnView = function () {

        };
        self.fnRTrade = function () {

        };
        self.fnRFX = function () {

        };
        self.fnSendToMaster = function () {

        };
        self.fnGenCheck = function () {

        };
        return self;
    };
    return new investInfo();
});